<template>
	<div class="deviceInfo">
		<van-nav-bar title="设备详情" left-arrow="" @click-left='goBack()'></van-nav-bar>
		<div class="area">
			<van-cell title="设备名称" :value="deviceInfo.facilityname"></van-cell>
			<van-cell title="设备编号" :value="deviceInfo.id"></van-cell>
			<van-cell title="设备生产商" :value="deviceInfo.producers"></van-cell>
			<van-cell title="规格类型" :value="deviceInfo.specifications"></van-cell>
			<van-cell title="设备所属" :value="deviceInfo.fDepName"></van-cell>
      <van-cell title="设备区域" :value="deviceInfo.areaName"></van-cell>
			<van-cell title="上次保养时间" :value="deviceInfo.preRepairTime"></van-cell>
			<van-cell title="保养内容" :value="deviceInfo.curContent"></van-cell>
			<van-cell title="保养周期(天)" :value="20"></van-cell>
			<!-- <van-cell title="下次保养内容" :value="无"></van-cell> -->
			<van-cell title="保养次数">{{deviceInfo.rNumbers}}</van-cell>
			<van-cell title="保养员/部门" :value="deviceInfo.rDepName"></van-cell>
			<van-cell title="维修/故障内容" :value="deviceInfo.mDepName"></van-cell>
			<van-cell title="维修次数">{{deviceInfo.mNumbers}}</van-cell>
			<van-cell title="维修部门" :value="deviceInfo.mDepName"></van-cell>
			<!-- <van-cell title="巡检员" :value="deviceInfo.iUserName"></van-cell>
			<van-cell title="巡检次数">{{deviceInfo.iNumbers}}</van-cell> -->

		</div>
	</div>
</template>

<script>
	import {Toast} from 'vant'

	export default {

		data() {
			return {
				deviceInfo:{},
				fileList: [],

				show: false, //图片放大预览

				isPreview: false, //是否预览当前图片

				deviceList:[],
				id:''
			}
		},
		mounted() {
			this.$forceUpdate()
		},
		created() {

			this.$forceUpdate()
			this.getDeviceInfo()
		},
		props: ['isScan','checkId'],
		methods: {
			checkok(){
				if(this.imgSrcArr.length === 0){
					return Toast.fail({message:'您还未上传图片',duration:860})
				}
				let params = new FormData()
				console.log(this.uploadFile.name)
				params.append('img',this.uploadFile)
				//params.append('id',this.checkId)
				params.append('name','htttt')
				let config = {
					header:{'Content-Type':'multipart/form-data'}
				}
				this.$axios.post('UploadFile/uploadFile.do',params,config).then(res=>{
					if(res.data.status === 200){
						Toast.success({message:'巡检合格',duration:900})
						/* setTimeout(()=>{
							this.isScan = true
						},900) */
					}
				})

			},
			//获取全部设备详情
			getDeviceInfo(){
				this.id = this.$route.params.id
				let id = ''
				if(this.isScan){
					id = this.checkId
				}else {
					id = this.id
				}
				this.$axios.post('/Facility/selectFacility.do',{facilityname:id}).then(res=>{
					if(res.data.status === 200){
						this.deviceInfo = res.data.msg[0]
					}
				})
			},


			goEditDevice() {
				this.$router.push({
					name: 'editDevice'
				})
			},
		},
		watch:{
			imgSrcArr(newVal){
				if(newVal.length === 0){
					this.show = false
				}
			}
		}
	}
</script>

<style scoped="scoped">

</style>
